package chapter16;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class Chapter16Main {

    public static void main(String[] args) {
        /**
         * 按结束时间F单调递增排序
         */
        int[] s = new int[]{1, 3, 0, 5, 3, 5, 6, 8, 8, 2, 12};
        int[] f = new int[]{4, 5, 6, 7, 9, 9, 10, 11, 12, 14, 16};
        List<Integer> r = new ArrayList<>();
        ActivitySelector.recursiveActivitySelector(s, f, 1, 10, r);
        System.out.println(r);
        List<Integer> r1 = ActivitySelector.greedyActivitySelector(s, f);
        System.out.println(r1);
        List<Integer> r2 = ActivitySelector.greedyActivitySelector2(s, f);
        System.out.println(r2);
        int[] c = new int[]{10, 20, 30};
        int[] w = new int[]{60, 100, 120};
        int n = 50;
        int k = 0;
        LinkedList<Integer> selector = new LinkedList<>();
        Pack.zeroOnePack(c, w, n, k, selector);
        System.out.println(Pack.max);
        System.out.println(Pack.maxSelector);
        int[] c1 = new int[]{0, 10, 20, 30};
        int[] w1 = new int[]{0, 60, 100, 120};
        int r3 = Pack.zeroOnePack(c1, w1, 3, 50);
        System.out.println(r3);
        int[] c2 = new int[]{10, 20, 30};
        int[] w2 = new int[]{120, 100, 60};
        int r4 = Pack.zeroOnePack2(c2, w2, 50);
        System.out.println(r4);
        int[] c3 = new int[]{10, 20, 30};
        int[] w3 = new int[]{120, 100, 60};
        double r5 = Pack.zeroOnePack3(c3, w3, 50);
        System.out.println(r5);
        Huffman.HuffmanNode[] A1 = new Huffman.HuffmanNode[6];
        A1[0] = new Huffman.HuffmanNode("f", 5);
        A1[1] = new Huffman.HuffmanNode("e", 9);
        A1[2] = new Huffman.HuffmanNode("c", 12);
        A1[3] = new Huffman.HuffmanNode("b", 13);
        A1[4] = new Huffman.HuffmanNode("d", 16);
        A1[5] = new Huffman.HuffmanNode("a", 45);
        Huffman.HuffmanNode root = Huffman.huffman(A1);
        System.out.println(root);
        int[] change = new int[]{25, 10, 5, 1};
        int r6 = Change.giveChange(change, 4, 25);
        System.out.println(r6);
        int counter = 0;
        Change.giveChange(change, 4, 25, counter);
        System.out.println(Change.minCounter);
    }

}
